<template>
  <el-container>
    <el-aside style="width: 45%">
      <el-table :data="commit1Table" style="width: 100%;margin-top:2px;">
        <el-table-column prop="worktime" label="工作时间" width="110px;"></el-table-column>
        <el-table-column label="月计划工作内容" prop="workInfo"></el-table-column>
      </el-table>
    </el-aside>
    <el-main style="margin:0px;padding:0px;padding-left:1px;">
      <el-table :data="commit2Table" style="width: 100%;margin-top:2px;">
        <el-table-column prop="worktime" label="工作时间" width="110px;"></el-table-column>
        <el-table-column prop="finishResultStr" label="完成结果" width="150px;"></el-table-column>
        <el-table-column label="绩效工作内容" prop="workInfo"></el-table-column>
      </el-table>
    </el-main>
  </el-container>
</template>
<script>
export default {
  data() {
    return {
      commit1Table: null,
      commit2Table: null
    };
  },
  created: function() {
    if (this.$route.params.eid) {
      window.sessionStorage.setItem("eid", this.$route.params.eid);
    }
    if (this.$route.params.attendanceId) {
      window.sessionStorage.setItem(
        "attendanceId",
        this.$route.params.attendanceId
      );
    }

    this.getCommit();
  },
  methods: {
    async getCommit() {
      var eid = window.sessionStorage.getItem("eid");
      var attendanceId = window.sessionStorage.getItem("attendanceId");
      var result = await this.$httpd.get(
        `/AttendanceCommint/QueryAttendanceCommintsAll?attid=${attendanceId}&empId=${eid}`
      );
      if (result.status != 200 || result.data.returnStatus == 0) {
        this.$message.error(result.data.message);
        return;
      }
      this.commit1Table = result.data.data.commitType1List;
      this.commit2Table = result.data.data.commitType2List;
    }
  }
};
</script>